﻿@model System.Data.DataTable

@{
    ViewBag.Title = "List";
}

<h2>Customer List</h2>
<div class="error-container">
</div>
<table class="grid no-border">
    <thead>
        <tr>
            <td class="gray-bkg no-border empty-cell">&nbsp;</td>
            <td class="silver-bkg no-border">#ID</td>
            <td class="silver-bkg no-border">| GivenName</td>
            <td class="silver-bkg no-border">| Surname</td>
            <td class="silver-bkg no-border">| Address</td>
            <td class="silver-bkg no-border">| Email</td>
            <td class="silver-bkg no-border">| Mobile</td>
            <td class="silver-bkg no-border">| Telephone</td>
            <td class="silver-bkg no-border">| Edit</td>
        </tr>
    </thead>
        <tbody>
@{
    <div class="menu buttons">
        <button class="dialog-btn" id="new" type="button" value="Cancel">@{@Html.ActionLink("New", "CreateCustomer", "Customer");}</button>
        <button class="dialog-btn" id="search" type="button" value="Cancel">@{@Html.ActionLink("Search", "Search", "Customer");}</button>
    </div>
    foreach (System.Data.DataRow row in Model.Rows)
    {
       @Html.Raw("<tr>");
       @Html.Raw("<td class='silver-bkg no-border'>&nbsp;</td>");
       @Html.Raw(String.Format("<td class='grid-bkg'>{0}</td>", row[0].ToString()));
       @Html.Raw(String.Format("<td class='grid-bkg'>{0}</td>", row[1].ToString()));
       @Html.Raw(String.Format("<td class='grid-bkg'>{0}</td>", row[2].ToString()));
       @Html.Raw(String.Format("<td class='grid-bkg'>{0}</td>", row[3].ToString()));
       @Html.Raw(String.Format("<td class='grid-bkg'>{0}</td>", row[4].ToString()));
       @Html.Raw(String.Format("<td class='grid-bkg'>{0}</td>", row[5].ToString()));
       @Html.Raw(String.Format("<td class='grid-bkg'>{0}</td>", row[6].ToString()));
       @Html.Raw("<td class='grid-bkg'>");
       @Html.Raw("<form id='frmEditCustomer' action='Customer/Detail' method='post'>");
       @Html.Raw("<input type='hidden' name='id' value='" + row[0].ToString() + "'>");
       @Html.Raw("<input type='submit' value='Edit' />");
       @Html.Raw("</form>");
       @Html.Raw("</td>");
       @Html.Raw("</tr>");
   }
}
        </tbody>
    </table>
    <div class="close-button">
        @using (Html.BeginForm("Index", "Main"))
        { 
            <input type="submit" value="Close" />
        }
    </div>